<template>
  <div>
    <el-pagination
      v-show="page.total > 0"
      :current-page="page.pageNum"
      :page-sizes="pageSizes"
      :page-size="page.pageSize"
      :total="page.total"
      layout="total, sizes, prev, pager, next, jumper"
      style="text-align: right;margin-top: 1%;white-space: normal;"
      @size-change="
        pageSizes => {
          page.pageSize = pageSizes
          changePage()
        }
      "
      @current-change="
        currentPage => {
          page.pageNum = currentPage
          changePage()
        }
      "
    />
  </div>
</template>

<script>
export default {
  props: {
    page: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      pageSizes: [10, 20, 50, 100]
    }
  },
  methods: {
    changePage() {
      this.$emit('handlePage', this.page)
    }
  }
}
</script>

<style></style>
